interface Area {
  width: number
  height: number
  minWidth: number
  minHeight: number
  top: number
  left: number
}

interface MoveLimit {
  vertical: boolean
  horizontal: boolean
  leftOut: boolean
  rightOut: boolean
  topOut: boolean
  bottomOut: boolean
}

interface ResizeLimit {
  t: boolean
  r: boolean
  b: boolean
  l: boolean
  lt: boolean
  rt: boolean
  lb: boolean
  rb: boolean
}

type BaseEventFunction = (layxWindow: HTMLDivElement, winform: WinForm) => void

interface BaseEvent {
  before: BaseEventFunction
  after: BaseEventFunction
}

interface OnLoad extends BaseEvent {}

interface OnMin extends BaseEvent {}

interface OnMax extends BaseEvent {}

interface OnRestore extends BaseEvent {}

interface OnDestroy {
  before: (layxWindow: HTMLDivElement, winform: WinForm, params: any, inside: any, escKey: any) => void
  after: BaseEventFunction
}

interface OnVisual {
  before: (layxWindow: HTMLDivElement, winform: WinForm, params: any, inside: any, status: any) => void
  after: BaseEventFunction
}

interface OnMove extends BaseEvent {}

interface OnResize extends BaseEvent {}

interface OnSwitch {
  before: (layxWindow: HTMLDivElement, winform: WinForm, frameId: string) => void
  after: (layxWindow: HTMLDivElement, winform: WinForm, frameId: string) => void
}

interface OnStick extends BaseEvent {}

interface Event {
  onload: OnLoad
  onmin: OnMin
  onmax: OnMax
  onrestore: OnRestore
  ondestroy: OnDestroy
  onvisual: OnVisual
  onmove: OnMove
  onresize: OnResize
  onswitch: OnSwitch
  onstick: OnStick
}

export interface WinForm {
  id: string
  title: string
  layxWindowId: string
  layxWindow: HTMLDivElement
  createDate: Date
  status: string
  type: string
  buttons: any[]
  frames: any[]
  useFrameTitle: boolean
  cloneElementContent: boolean
  storeStatus: boolean
  url: string
  content: HTMLElement
  escKey: boolean
  focusToReveal: boolean
  dialogType: string
  enableDomainFocus: boolean
  buttonKey: string
  existFlicker: boolean
  groupCurrentId?: any
  area: Area
  border: boolean
  control: boolean
  isFloatTarget: boolean
  floatTarget: boolean
  floatDirection: string
  loadingText: string
  focusable: boolean
  isStick: boolean
  zIndex: number
  movable: boolean
  moveLimit: MoveLimit
  resizable: boolean
  resizeLimit: ResizeLimit
  stickable: boolean
  minable: boolean
  maxable: boolean
  restorable: boolean
  closable: boolean
  skin: string
  event: Event
  dragInTopToMax: boolean
}

